package com.zhuss.food.processor;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;

import com.zhuss.bean.vo.food.food.DetailFoodVo;
import com.zhuss.enums.StartStopEnum;
import com.zhuss.exception.WpsException;


@Component("foodCheck")
public class FoodCheck {
	
	@Autowired
	@Qualifier("foodRead")
	private FoodRead foodRead;

	
	public boolean checkStart(Long foodId) throws WpsException {
		DetailFoodVo food = ((DetailFoodVo) foodRead.detail(foodId));
		if (StartStopEnum.停用.sameKey(food.getStatus())) {
			return true;
		}
		return false;
	}
	
	public boolean checkStop(Long foodId) throws WpsException {
		DetailFoodVo food = ((DetailFoodVo) foodRead.detail(foodId));
		if (StartStopEnum.启用.sameKey(food.getStatus())) {
			return true;
		}
		return false;
	}

}
